package com.guguskins.back.controller;


import com.fasterxml.jackson.annotation.JsonFormat;
import com.guguskins.back.entity.vo.ResultVo;
import com.guguskins.back.service.GuCurrencyRecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author mybatis-plus
 * @since 2021-07-21
 */
@RestController
@RequestMapping("/guCurrencyRecord")
public class GuCurrencyRecordController {
    @Autowired
    private GuCurrencyRecordService currencyRecordService;

    @GetMapping("back/getPage")
    public ResultVo backGetPage(
            @RequestParam(value = "pageNum", required = false) int pageNum,
            @RequestParam(value = "pageSize", required = false) int pageSize,
            @RequestParam(value = "userName" ,required = false) String userName,
            @RequestParam(value = "sourceType",required = false) Integer sourceType,
            @RequestParam(value = "createTime",required = false) String createTime
    ) {
        if(sourceType!=null) {
            if (sourceType == -1) {
                sourceType = null;
            }
        }
        return ResultVo.success(currencyRecordService.getPage(pageNum, pageSize,userName,sourceType,createTime), "查找成功");
    }
//    @GetMapping("back/like")
//    public ResultVo backLike(
//            @RequestParam(value = "userName" ,required = false) String userName,
//            @RequestParam(value = "sourceType",required = false) Integer sourceType,
//            @RequestParam(value = "createTime",required = false)String createTime
//    ){
//        return ResultVo.success(currencyRecordService.getLike(userName,sourceType,createTime));
//    }
}
